Repository navigation
feat: skip the Swift Testing tests a skip list names - #38
Merged
Merged
Conversation
The `.coverageAttribution` trait asks the observer whether the skip list names the running test and, when it does, cancels it with `Test.cancel` before it starts, which reports it as skipped. `Test.cancel` arrived in Swift 6.3, so older compilers run the listed tests: a test a trait doesn't run is reported as passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`mise run test-skip-list`, which CI runs on the oldest and newest Xcode, filtered on `skipsTheListedTests`, which doesn't match `skipsTheListedSwiftTestingTests`. The full suite runs only on Xcode 26.3 (Swift 6.2), so the Swift 6.3 cancel path under SwiftPM never ran in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
esnunes
marked this pull request as ready for review
November 9, 2026 19:09
This was referenced Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
.coverageAttributiontrait now skips the Swift Testing tests thatTEST_COVERAGE_ATTRIBUTION_SKIP_FILEnames. For a listed test, it callsTest.cancelbefore the test starts. Swift Testing reports the test as skipped: Xcode and the.xcresultshow Skipped, andswift testsays it was cancelled.test_coverage_attribution_is_skipped(module, suite, name)checks the skip list the constructor already loads. It matches names the way XCTest tests are matched, so the format is unchanged. A line names a Swift Testing test the way its records do: the Swift module, the innermost suite, then the display name or the function (ExampleTests/MultiplicationTests/multiply()).Test.cancelarrived in Swift 6.3 (Xcode 26.4). Before that, a trait can skip a test only by not running it, and Swift Testing then reports the test as passed. So under#if compiler(>=6.3)the trait cancels, and on older compilers listed tests run as before./can't be listed.@_documentation(visibility: private)is removed now that the README names the trait. AGENTS.md is updated to match.Why
Skipping covered XCTest only. The README said "a trait has no public way to skip a test", which stopped being true with Swift 6.3's
Test.cancel; DataDog'sdd-sdk-swift-testinguses it for Test Impact Analysis.Alternatives considered
cancelcompiles to nothing there. Here, older compilers run the tests instead..enabled(if:)/.disabled: the condition closure isn't told which test it's on, so one suite-level trait can't look tests up in a list.load_skip_list()and its name normalization. Asking the observer keeps one parser.Impact
Validation
swift testpasses all 12 tests.skipsTheListedTestsruns serial, parallel and as a shard. In the result bundle, the listed Swift Testing tests show Skipped, the parameterized one included. The unlisted one, and a listed one in a suite without the trait, show Passed. The XCTest expectations are unchanged.skipsTheListedSwiftTestingTests: under SwiftPM, a test listed by its display name leaves no record, and the other test does.swift test --filter skipsTheListedpasses, with the listed tests run and reported as Passed.mise run test-skip-list, which CI runs on Xcode 26.0.1 and 27.0, now runs both skip tests: the full suite runs only on Xcode 26.3, so without it the Swift 6.3 path under SwiftPM wouldn't run in CI.mise run lintis clean.🤖 Generated with Claude Code